<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
    <meta charset="UTF-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>列表</title>
    <link rel="stylesheet" type="text/css" href="css/list-style.css">
    <link rel="stylesheet" type="text/css" href="css/nav1.css">
    <link rel="stylesheet" type="text/css" href="css/bankcard-style.css">
	<link rel="stylesheet" type="text/css" href="admin-html/lib/layui/css/layui.css">
	<script src="https://cdn.bootcss.com/jquery-cookie/1.4.1/jquery.cookie.js"></script>
</head>
<body>
<nav class="mynav">
    <ul>
        <li><a href="" onclick="window.open('index.html')">首 &nbsp 页</a></li>
        <li><a href="" onclick="window.open('bankcardlist.html')">我的银行卡</a></li>
        <li><a href="" onclick="window.open('deallist.html')">我的流水</a></li>
        <li><a href="" onclick="window.open('applydebitcard.html')">申请借记卡</a></li>
        <li><a href="" onclick="window.open('personalcenter.html')">个人中心</a></li>
        <li><a href="" onclick="window.open('helpandsupport.html')">帮助与支持</a></li>
    </ul>
</nav>
<span class="target"></span>
<!--银行卡-->
<div class="cardcontainer">
    <div class="cover atvImg">
        <div class="atvImg-layer" data-img="images/bankcard_img/visa-bg.jpg"></div>
        <div class="atvImg-layer" data-img="images/bankcard_img/visa.png"></div>
    </div>
</div>
<div class="balance">卡内余额 : $
    <input type="text" value="9999" readonly="readonly" id="money">
</div>
<br />
<div class="balance">
<button type="button" class="layui-btn layui-btn-normal layui-btn-radius" style="width: 100px; height: 50px;background-color: #00B274;" onclick="f1()">存钱</button>
</div>
<!--//银行卡-->
<!--流水列表-->
<div class="container">
    <div class="component">
        <table>
            <thead>
            <tr>
                <th>银行卡号</th>
                <th>交易时间</th>
                <th>交易金额</th>
                <th>交易类型</th>
            </tr>
            </thead>
            <tbody id="dealList">
            </tbody>
        </table>
    </div>
</div>
<!--//流水列表-->
<script src="js/jquery.min.js"></script>
<script src="js/bankcard.js"></script>
<script src="js/nav1.js"></script>
<script src="js/jquery.js"></script>
<script type="text/javascript">
    var cardnum = window.location.search;
    cardnum = decodeURI(cardnum.substr(9).split('&')[0]);
    var data={
        "cardnum":cardnum
    }
    $.ajax({
        url: "http://www.longm.top:8080/lm/Card/GetAllDeatil",
        type: "POST",
        dataType:"json",
        headers:{
            'Content-Type':'application/json',
            "token":window.localStorage.getItem("token")
        },
        cache: false,
        async: true,
        contentType: "application/x-www-form-urlencoded",
        data: JSON.stringify(data),
        success: function (res) {
            console.log(JSON.stringify(res));
            var result = res.data;
            $("#money").val(result.money);
			
            for(let i=0;i<result.dealdetails.length;i++) {
				var date = new Date(result.dealdetails[i].dealtime);
                $('#dealList').append("<tr>" +
                    "<td class='card_id'>" + cardnum + "</td>" +
                    "<td class='deal_time'>" + dateFormat("YYYY-mm-dd HH:MM", date)+"</td>" +
                    "<td class='deal_money'>" + result.dealdetails[i].money +"</td>" +
                    "<td class='deal_type'>" + result.dealdetails[i].dealtypeid +"</td>" +
                    "</tr>")
            }

        }
    });
	function dateFormat(fmt, date) {
		let ret;
		const opt = {
			"Y+": date.getFullYear().toString(), // 年
			"m+": (date.getMonth() + 1).toString(), // 月
			"d+": date.getDate().toString(), // 日
			"H+": date.getHours().toString(), // 时
			"M+": date.getMinutes().toString(), // 分
			"S+": date.getSeconds().toString() // 秒
			// 有其他格式化字符需求可以继续添加，必须转化成字符串
		};
		for (let k in opt) {
			ret = new RegExp("(" + k + ")").exec(fmt);
			if (ret) {
				fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
			};
		};
		return fmt;
	}
	
	function f1(){
		var cardid = localStorage.getItem("cardid");
		// localStorage.setItem("cardid",cardid);
		window.location.href='savemoney.html';
	}
	
	
</script>
</body>
</html>